AI Verified

Name

Stop success email of plugin auto update.

About

This code snippets will stop all auto update success e-mails from being sent out. It will only send out emails when a plugin update fails.

Language

PHP

Rating

Voted: 1 by 1 user(s)

How to Setup Snippet

Add the following code snippet to any code snippets plugins or in the functions.php file. https://easywebdesigntutorials.com/how-to-disable-update-emails-on-success/ Thanks to Colin @costdev on Slack. https://wordpress.slack.com/archives/CULBN711P/p1656468319331729 Resource: https://github.com/afragen/wordpress-beta-tester/blob/develop/src/WPBT/WPBT_Extras.php#L336-L369 Thanks to Andy, John and Colin for sharing code!

Codevault

Easy Web Design Tutorials

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

23/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Stop success email of plugin auto update.

 
                    
1add_filter( 'auto_plugin_update_send_email', 'plugin_update_email_on_failure', 10, 2 );
2 
3/**
4 * Sends plugin update emails only when at least one plugin update has failed.
5 * Thanks to Colin @costdev on Slack. https://wordpress.slack.com/archives/CULBN711P/p1656468319331729
6 *
7 * @param bool $enabled Whether the plugin update email is enabled.
8 * @param array $update_results An array of update results.
9 * @return bool
10 */
11function plugin_update_email_on_failure( $enabled, $update_results ) {
12 foreach ( $update_results as $update_result ) {
13 if ( false === $update_result->result ) {
14 return true;
15 }
16 }
17 return false;
18}

1

Related Snippets

Please see some snippets below related to this snippet..

WordPress Admin

Unverified

0

Noore Alam Alam Shahariya

Added: 10 months ago

Last Updated: 10 months ago

WordPress Admin

AI Verified

0

Hide admin notices for all users except 1

Added: 1 year ago

Last Updated: 1 year ago

Hide admin notices for all users except 1, defined by user ID

WordPress Admin

AI Verified

2

Convert Uploaded Images to WebP Format

Added: 9 months ago

Last Updated: 2 months ago

This snippet converts uploaded images (JPEG, PNG, GIF) to WebP format * automatically in WordPress. Ideal for use in a theme's functions.php file, * or with plugins like Code Snippets or WPCodeBox...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

1

Stop success email of plugin auto update.

Added: 1 year ago

Last Updated: 1 year ago

This code snippets will stop all auto update success e-mails from being sent out. It will only send out emails when a plugin update fails.

Tracking - Analytics

AI Verified

1

Google tag added to head

Added: 1 year ago

Last Updated: 1 year ago

Google tag code added to the head of the web site

General

AI Verified

1

Remove CTP name from URL slug

Added: 1 year ago

Last Updated: 1 year ago

Code removes the Custom Post Type (CPT) name from the URL slug.